package Views::Helpers::Meta;
use warnings;

sub new {
	return bless {name=>'meta tags', title => undef, description => undef, keywords => undef, charset => 'text/html; charset=utf-8'}, shift;
}

sub getName {
	my $self = shift;
	return $self->{name};
}

sub setTitle {
	my $self = shift;	
	my $title = shift;
	$$self{title} = "$title";
}
sub addTitle {
	my $self = shift;	
	my $title = shift;
	$$self{title} .= "$title";
}
sub getTitle {
	my $self = shift;
	return "<meta content=\"$self->{title}\" name=\"title\">";
}


sub setDescription {
	my $self = shift;	
	my $description = shift;
	$$self{description} = "$description";
}
sub addDescription {
	my $self = shift;	
	my $description = shift;
	$$self{description} .= "$description";
}
sub getDescription {
	my $self=shift;
	return "<meta content=\"$self->{description}\" name=\"description\">";
}

sub setKeywords {
	my $self=shift;	
	$$self{keywords} = undef;
	$$self{keywords} .= " $_," foreach (@_);
}
sub addKeywords {
	my $self=shift;	
	$$self{keywords} .= " $_," foreach (@_);
}
sub getKeywords {
	my $self=shift;
	return "<meta content=\"$self->{keywords}\" name=\"keywords\">";
	
}

sub setContentType {
	my $self=shift; 
	my $charset = shift;
	$$self{charset} = "<meta content=\"$charset\" http-equiv=\"content-type\">";
}
sub getContentType {
	my $self=shift; 
	return $self->{charset};
}

sub getValues {
	my $self=shift;
	# $$self{keywords} = "<meta content=\"$self->{keywords}\" name=\"keywords\">";
	# $$self{description} = "<meta content=\"$self->{description}\" name=\"description\">";
	# $$self{title} = "meta content=\"$self->{title}\" name=\"title\">";
	return {
		title => "<meta content=\"$self->{keywords}\" name=\"keywords\">", 
		description => "<meta content=\"$self->{description}\" name=\"description\">", 
		keywords => "<meta content=\"$self->{title}\" name=\"title\">", 
		charset => "<meta content=\"$self->{charset}\" http-equiv=\"content-type\">"
		};
}
 
1;